% \usepackage{natbib}
\usepackage{url}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{parskip}
\usepackage{adjustbox}
\usepackage{subfigure}  %插入多图时用子图显示的宏包
\usepackage{fancyhdr}
\usepackage{commath}%定义d
% \usepackage[UTF8,heading=true]{ctex}
\usepackage{geometry}
\usepackage{bm}
\usepackage{titlesec}
\usepackage{caption}
\usepackage{paralist}
\usepackage{multirow}
\usepackage{booktabs} % To thicken table lines
\usepackage{titletoc}
\usepackage{diagbox}
\usepackage{bm}
\usepackage{autobreak}
\usepackage{authblk}
\usepackage{indentfirst}
\usepackage{float}
\usepackage{amsthm}
\usepackage{fontspec}
\usepackage{color}
%\usepackage{txfonts} %设置字体为times new roman
\usepackage{lettrine}
\usepackage{nameref}
%\usepackage[nottoc]{tocbibind}
\usepackage{amssymb}%font
\usepackage{lipsum}%make test words
\usepackage{picinpar}%words around the picture
\usepackage[all]{xy}%draw arrow
\usepackage{asymptote}%draw picture
\usepackage[perpage]{footmisc}%脚注每页清零
\usepackage[cmyk]{xcolor}
\usepackage{titling}
\usepackage{lipsum}
\usepackage{setspace}

% 页面尺寸设置
\geometry{
   textwidth=138mm,
   textheight=215mm,
   a4paper,
   left=25mm,
   right=20mm,
   top=25mm,
   bottom=25mm,
   headheight=2cm,
   headsep=7mm,
   footskip=7mm,
   % footnotesep=20mm,
   heightrounded,
}

% \geometry{bottom=2.5cm,left=2cm,right=2cm,top=2.5cm}
\newcommand{\crefrangeconjunction}{ - }
\setlength{\parindent}{2em}

\ctexset{today=big}%日期类型设置

\renewcommand{\chaptermark}[1]{\markboth{\CTEXthechapter\ \ \ #1}{}}

\titlecontents{chapter}[-3pt]{\addvspace{5pt}\filright\sf\bfseries\normalsize}%
{\contentspush{\thecontentslabel \ \ \,}}%
{}{{\mdseries\titlerule*[1pc]{.}}\contentspage}

\titlecontents{section}[12pt]{\addvspace{5pt}\normalsize}%
{\contentspush{\thecontentslabel \ \ \,}}%
{}{\titlerule*[1pc]{.}\contentspage}

\titlecontents{subsection}[24pt]{\addvspace{5pt}\normalsize}%
{\contentspush{\thecontentslabel \ \ \,}}%
{}{\titlerule*[1pc]{.}\contentspage}

\titleformat{\section}
{\normalfont\sanhao}{\thesection}{1em}{}

\titleformat{\chapter}{\vspace{-30pt}\sanhao\sf\bfseries\centering}{第\,\chinese{chapter}\,章}{1em}{}

\titlespacing{\chapter}{0pt}{24pt}{18pt}

\titlespacing{\section}{0pt}{24pt}{18pt}

\titlespacing{\subsection}{0pt}{12pt}{6pt}

\titleformat{\subsection}
{\normalfont\sihao}{\thesubsection}{1em}{}

% ======================================
% = Color de la Universidad de Sevilla =
% ======================================
\usepackage{tikz}
\definecolor{PKUred}{cmyk}{0,1,1,0.45}
%超链接设置(包括颜色)
\usepackage[breaklinks,colorlinks,linkcolor=PKUred,citecolor=PKUred,urlcolor=black]{hyperref}
\usepackage{cleveref}
\usepackage{cite}

% 参考文献引用样式设置
\newcommand{\upcite}[1]{\textsuperscript{\textsuperscript{\cite{#1}}}}

% 脚注设置
% \renewcommand*\footnoterule{%
%     \vspace*{-3pt}%
%     {\color{PKUred}\hrule width 2in height 0.4pt}%
%     \vspace*{2.6pt}%
% }


%% Color the bullets of the itemize environment and make the symbol of the third
%% level a diamond instead of an asterisk.
%h\renewcommand*\textbullet{\dag}
\renewcommand*\labelitemi{\color{PKUred}\textbullet}
\renewcommand*\labelitemii{\color{PKUred}--}
\renewcommand*\labelitemiii{\color{PKUred}$\diamond$}
\renewcommand*\labelitemiv{\color{PKUred}\textperiodcentered}


% %%% Equation and float numbering
% \numberwithin{equation}{section}		% Equationnumbering: section.eq#
% \numberwithin{figure}{section}			% Figurenumbering: section.fig#
% \numberwithin{table}{section}				% Tablenumbering: section.tab#


%代码设置
\usepackage{listings}
\usepackage{fontspec} % 定制字体
% \newfontfamily\menlo{Menlo}
\usepackage{xcolor} % 定制颜色
\definecolor{mygreen}{rgb}{0,0.6,0}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{mymauve}{rgb}{0.58,0,0.82}
\lstset{ %
   backgroundcolor=\color{white},      % choose the background color
   basicstyle=\footnotesize\ttfamily,  % size of fonts used for the code
   columns=fullflexible,
   tabsize=4,
   breaklines=true,               % automatic line breaking only at whitespace
   captionpos=b,                  % sets the caption-position to bottom
   commentstyle=\color{mygreen},  % comment style
   escapeinside={\%*}{*)},        % if you want to add LaTeX within your code
   keywordstyle=\color{blue},     % keyword style
   stringstyle=\color{mymauve}\ttfamily,  % string literal style
   frame=single,
   rulesepcolor=\color{red!20!green!20!blue!20},
   % identifierstyle=\color{red},
   language=c++,
   xleftmargin=4em,xrightmargin=2em, aboveskip=1em,
   framexleftmargin=2em,
   numbers=left
}

%脚注
\renewcommand\thefootnote{\fnsymbol{footnote}}

% 定义常数i、e、积分符号d
\newcommand\mi{\mathrm{i}}
\newcommand\me{\mathrm{e}}

%%% Maketitle metadata
\newcommand{\horrule}[1]{\rule{\linewidth}{#1}}		% Horizontal rule
\newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}}

\newcommand{\chuhao}{\fontsize{42pt}{\baselineskip}\selectfont}
\newcommand{\xiaochuhao}{\fontsize{36pt}{\baselineskip}\selectfont}
\newcommand{\yihao}{\fontsize{26pt}{\baselineskip}\selectfont}
\newcommand{\erhao}{\fontsize{22pt}{\baselineskip}\selectfont}
\newcommand{\xiaoerhao}{\fontsize{18pt}{\baselineskip}\selectfont}
\newcommand{\sanhao}{\fontsize{16pt}{\baselineskip}\selectfont}
\newcommand{\sihao}{\fontsize{14pt}{\baselineskip}\selectfont}
\newcommand{\xiaosihao}{\fontsize{12pt}{\baselineskip}\selectfont}
\newcommand{\wuhao}{\fontsize{10.5pt}{\baselineskip}\selectfont}
\newcommand{\xiaowuhao}{\fontsize{9pt}{\baselineskip}\selectfont}
\newcommand{\liuhao}{\fontsize{7.5pt}{\baselineskip}\selectfont}
\newcommand{\qihao}{\fontsize{5.5pt}{\baselineskip}\selectfont}

% 全角符号变为半角
\catcode`\。=\active
\catcode`\，=\active
\catcode`\；=\active
\catcode`\：=\active
\newcommand{。}{．}
\newcommand{，}{,}
\newcommand{；}{;}
\newcommand{：}{:}
